var DWZ=parent.DWZ;
$(document).ready(function(){
//	getList();	
});

var choiceLists={};
function getList(){
	var url="/demo/list";
	DWZ.get(url,function(msg){
		var listContainer=$("#listContainer");
		var templet = $("#templet").html();
		var lists = msg.result||[];
		$.each(lists,function(i,list){
			var row = templet.replace(/\${title}/g,list.title).replace(/\${list_id}/g,list.list_id);
			var container = list.container;
			var listTemplet = list.templet.replace(/\${list_id}/g,list.list_id)
			.replace(/\${title}/g,list.title).replace(/\${sign}/g,list.sign)
			.replace(/\${clazz}/g,list.clazz).replace(/\${description}/g,list.description);
			
			container=container.replace(/\${container}/,listTemplet);
			row=row.replace(/\${container}/,container);
			
			row=$(row);
			
			$(">div[name=head] input[type=checkbox]",row).click(function(e){
				if(this.checked){
					choiceLists["list_id"+list.list_id]={
						data:list,
						demo:container
					}
					$(this).parents("div[name=head]").next().css("border","red 1px solid");
				}else{
					delete choiceLists["list_id"+list.list_id];
					$(this).parents("div[name=head]").next().css("border","red 0px solid");
				}
			});//.data("list",container);
			
			row.appendTo(listContainer);
		})
	})
}

/**
 * 执行选择操作
 */
function choice(){
	var content=$("#content").val();
	alert(content);
	if(callback)callback(content);
}